<?php
use yii\helpers\Html;
use yii\helpers\Url;
use app\lib\WeixinUtils;

/* @var $this yii\web\View */
/* @var $content string 字符串 */


$web = Url::to("@web");

?>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>余额变动</title>
    <link href="<?=$web?>/css/fx/achievement_withdrawals.css?0" rel="stylesheet" type="text/css">
    <link href="<?=$web?>/css/fx/global.css" rel="stylesheet" type="text/css">
    <script src="<?=$web?>/js/jquery.js"></script>
    <script src="<?=$web?>/js/tools.js"></script>
    <script>
        $(function ($) {
            var w = $(document).width();
            if (w > 640) {
                w = 640;
              //  console.log(w);
            }
            $("html").css("font-size", w * 20 / 320);

            loadRList();
            $(document).scroll(function () {
                var scrollTop = $(this).scrollTop();
                var scrollHeight = $(window).height();
                var contentHeight = $(this).height();
                // alert(scrollTop+"="+scrollHeight+"="+contentHeight);
                if (scrollTop + scrollHeight >= contentHeight) {
                    // alert(1);
                    loadRList();
                }
            });
        });

        var start = 0;
        var pagesize=12;

        var myBalanceList_tpl=returnstring('<?=$web?>/js/fx/myBalanceList.tpl');
        function loadRList() {

            var data = {};
            data.start = start;
            data.pagesize = pagesize;


            var re = returnjson("<?=Url::to(['wx-fx/get-my-balance-list-handle'])?>", data);

            if (re.flag == 0) {
                alert(re.msg);
                return;
            } else {
                var target = $(".drawing_board");
//                0：提现
//                1：下线用户消费以后的折扣差额收入
//                2：下线用户消费以后公司的利润返点
//                3：消费

                $.each(re.reList, function (i, item) {
                    var dom = document.createElement("div");
                    dom.innerHTML = myBalanceList_tpl._format({
                        ID:item.ID,
                        CTYPE:item.CASH_RECORD_TYPE,
                        WEB:'<?=$web?>',
                        MONEY:parseFloat(item.CASH),
                        TYPECSS:function(ctype){
                            var result='right_withdrawals';
                            if(ctype==1 || ctype==2){
                                result='right_commission';
                            }
                            return result;
                        }(item.CASH_RECORD_TYPE),
                        FLAG:function(ctype){
                            var result='-';
                            if(ctype==1 || ctype==2){
                                result='+';
                            }
                            return result;
                        }(item.CASH_RECORD_TYPE),
                        TITLE: function(ctype){
                            var result='right_withdrawals';
                            if(ctype==0){
                                result='金额提现';
                            }
                            if(ctype==1){
                                result='折扣收益';
                            }
                            if(ctype==2){
                                result='分享收益';
                            }
                            if(ctype==3){
                                result='消费';
                            }
                            return result;
                        }(item.CASH_RECORD_TYPE),
                        TIME: item.CREATE_DATETIME

                    });
                    target.get(0).appendChild(dom);
                });

                start = start + re.reList.length;

            }

        }
        viewSchedule=function(id,ctype){
            if(ctype==0){
                window.location.href = "<?=Url::to(["wx-fx/get-cash-schedule"]);?>?rid="+id ;
            }
            if(ctype==1 || ctype==2){
                window.location.href = "<?=Url::to(["wx-fx/result-schedule"]);?>?rid="+id ;
            }

        };

    </script>
</head>
<body style="background-color: #fff">

<div class="drawing_board">

    <!--<div class="head_frame">
        <div class="head_left">
            <div class="left_title"><span>余额提现</span></div>
            <div class="left_time"><span>2016-02-01&nbsp;17:36</span></div>
        </div>
        <div class="head_right">
            <div class="right_img"><img src="imgs/withdrawals_details_4.png" style="width: 0.4rem;height: 0.6rem"></div>
            <div class="right_withdrawals"><span>-</span><span>10000</span></div>
        </div>
    </div>

    <div class="head_frame">
        <div class="head_left">
            <div class="left_title"><span>分销收益</span></div>
            <div class="left_time"><span>2016-02-01&nbsp;17:36</span></div>
        </div>
        <div class="head_right">
            <div class="right_img"><img src="imgs/withdrawals_details_4.png" style="width: 0.4rem;height: 0.6rem"></div>
            <div class="right_commission"><span>+</span><span>10000</span></div>
        </div>
    </div>-->



</div>
</body>
</html>